//
//  ServiceViewController.m
//  car
//
//  Created by chenxu on 15/3/15.
//  Copyright (c) 2015年 chenxu. All rights reserved.
//

#import "ServiceViewController.h"
#import "NetAPIManager.h"
@interface ServiceViewController ()

@end

@implementation ServiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _submit.layer.cornerRadius = kCornerRadius;
    _content.layer.cornerRadius = kCornerRadius;
    [_submit setPopingPressed];
    [_shensu setPopingPressed];
    [_help setPopingPressed];
    [_tip setPopingPressed];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSDictionary* )toParams{
    return nil;
}

- (IBAction)submit:(id)sender {
    [[NetAPIManager sharedManager]send_feedback:[self toParams] andBlock:^(id data, NSError *error) {
        [self showHudTipStr:@"提交成功"];
    }];
}

- (IBAction)selectShensu:(id)sender {
    _kind = shensu;
    [_shensu setSelected:true];
    [_tip setSelected:false];
    [_help setSelected:false];
}

- (IBAction)selectJianyi:(id)sender {
    _kind = jianyi;
    [_shensu setSelected:false];
    [_tip setSelected:true];
    [_help setSelected:false];
}

- (IBAction)selectBangzhu:(id)sender {
    _kind = bangzhu;
    [_shensu setSelected:false];
    [_tip setSelected:false];
    [_help setSelected:true];
}

#pragma UITextviewDelegate
- (void)textViewDidBeginEditing:(UITextView *)textView{
    [UIView up:self.view length:30];
    UIBarButtonItem *done =
    [[UIBarButtonItem alloc]
     initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(leaveEditMode)];
    
    self.navigationItem.rightBarButtonItem = done;
}
- (void)leaveEditMode
{
    [UIView downWithTopBar:self.view];
    self.navigationItem.rightBarButtonItem = nil;
    [self.content resignFirstResponder];
}


@end
